package com.lagou.edu.controller;

import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class ResumeController {

    @Autowired
    private ResumeService resumeService;

    /**
     * 注册接口
     *
     * @param email
     * @param password
     * @param code
     * @return
     */
    @GetMapping("/register/{email}/{password}/{code}")
    public Boolean register(@PathVariable String email, @PathVariable String password, @PathVariable String code) {
        System.out.println("code:"+code);
        System.out.println("email:"+email);
        System.out.println("password:"+password);
        return true;
    }

    /**
     * 是否已注册，根据邮箱判断
     * true代表已经注册过
     * false代表尚未注册
     * @param email
     * @return
     */
    @GetMapping("/isRegistered/{email}")
    public Boolean isRegistered(@PathVariable String email) {
        System.out.println("email:"+email);
        return true;
    }

    /**
     * 登录接⼝口，验证⽤用户名密码合法性，根据⽤用户名和
     * 密码⽣生成token，token存⼊入数据库，并写⼊入cookie
     * 中，登录成功返回邮箱地址，重定向到欢迎⻚页
     * @param email
     * @param password
     * @return
     */
    @GetMapping("/login/{email}/{password}")
    public String login(@PathVariable String email, @PathVariable String password){
        System.out.println("email:"+email);
        System.out.println("password:"+password);
        return "qq@qq.com";
    }
}
